package me.stone.stanimeclient.core.data.repository

import me.stone.stanimeclient.core.model.FanDetailData
import me.stone.stanimeclient.core.model.FanIntroItem
import me.stone.stanimeclient.core.model.FanRankItem
import me.stone.stanimeclient.core.model.FanSimpleItem
import me.stone.stanimeclient.core.model.FanWeekUpdateData

interface RemoteFanDataRepository {

    // 获取首页Banner数据
    suspend fun listBannerData(): List<FanSimpleItem>

    // 获取番剧更新数据
    suspend fun listUpdateData(): List<FanWeekUpdateData>

    // 获取少量的推荐列表（目前用于更新首页推荐文字）
    suspend fun listLimitRecommend(): List<FanSimpleItem>

    // 获取当日推荐列表
    suspend fun listRecommendData(): SimplePageResponse

    // 获取当日排行数据
    suspend fun loadRankDataList(premiereYear: Int? = null): RankResponse

    // 获取所有最近更新的番剧数据
    suspend fun loadRecentUpdateList(
        page: Int, pageSize: Int
    ): SimplePageResponse

    // 获取番剧目录
    suspend fun loadCatalogList(
        page: Int, filter: Map<String, String> = emptyMap(), pageSize: Int = 12
    ): DetailPageResponse

    // 搜索番剧
    suspend fun searchFanDataList(
        query: String, page: Int
    ): SearchResponse

    // 查看番剧详细数据
    suspend fun queryFanData(id: Int): FanDetailData

    // 排行榜数据
    data class RankResponse(
        // 番剧首播年份
        val premiereYear: Int? = null,
        // 周榜数据
        val weekly: List<FanRankItem>,
        // 月榜数据
        val monthly: List<FanRankItem>,
        // 总榜数据
        val overall: List<FanRankItem>
    )

    data class SimplePageResponse(
        // 番剧总数
        val totalCount: Int,
        // 总页数
        val totalPage: Int,
        // 当前页
        val currentPage: Int,
        // 每页番剧数量
        val pageSize: Int,
        // 番剧数据
        val data: List<FanSimpleItem>
    )

    data class DetailPageResponse(
        // 番剧总数
        val totalCount: Int,
        // 总页数
        val totalPage: Int,
        // 当前页
        val currentPage: Int,
        // 每页番剧数量
        val pageSize: Int,
        // 番剧数据
        val data: List<FanIntroItem>
    )

    data class SearchPageData(
        val totalCount: Int,
        val totalPage: Int,
        val currentPage: Int,
        val query: String,
        val data: List<FanIntroItem>
    )

    data class SearchResponse(
        val code: Int,
        val message: String,
        val data: SearchPageData? = null
    )

}